home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.centrum.is!news
- From: bjarnir@centrum.is (Bjarni Ragnarsson)
- Newsgroups: comp.lang.c++
- Subject: Re: Advanced C++ question...
- Date: 23 Mar 1996 13:26:26 GMT
- Organization: BR Software
- Message-ID: <4j0u62$6na@newshost.centrum.is>
- References: <4iprfg$1ui@aadt> <DoMH88.5wv@mv.mv.com>
- NNTP-Posting-Host: tungl-51.centrum.is
- X-Newsreader: WinVN version 0.82
-
- In article <DoMH88.5wv@mv.mv.com>, ENGR@GSSI.MV.COM (Michael Furman) says:
- >
- >In article <4iprfg$1ui@aadt>, david_hooker@sdt.com says...
- >>
- >>Hi all...
- >>
- >>I want to write an operator* for a class, but I want to do
- >>one of 2 things:
- >> 1. Call one of two different operator*'s depending on whether
- >> it is an lvalue or rvalue
- >> OR
- >> 2. Somehow determine in the function if it is being used as an
- >> lvalue or an rvalue.
- >>
- >>For instance, I want to know, in the operator*, from which case I'm
- >>being called:
- >>
- >> *Object = SomeValue; // used as an lvalue
- >>
- >> SomeValue = *Object; // used as an rvalue
- >>
- >>
- >>The reason for this is that this class accesses data differently
- >depending
- >>on if it is a read or write access.
- >
- >It is impossible with "*" operator. But you can define conversion
- >functions
- >for your class - it will allow exactly what you need.
- >
-
- Could you explain this a bit further. I have a similar problem to solve.
-
- Thanks,
- Bjarni Ragnarsson
- bjarnir@centrum.is
-